package xyz.jangle.design.memento;

public class AppMain25 {

	public static void main(String[] args) {
		
		Originator originator = new Originator();
		Caretaker caretaker = new Caretaker();
		originator.useState();
		System.out.println(originator.state);	//此处是1
		caretaker.saveMemento(originator.createMemento());
		originator.useState();
		System.out.println(originator.state);	//此处是2
		originator.restoreFromMemento(caretaker.getMemento());
		System.out.println(originator.state);	//此处还原至1

	}

}
